using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DataAccessLayer
{
    public class DAO_Test_Question_Solution
    {
        public static bool Insert(Object tmp)
        {
            TEST_QUESTION_SOLUTION obj = (TEST_QUESTION_SOLUTION)tmp;
            bool result = false;
            List<SqlParameter> _list = new List<SqlParameter>();
            _list.Add(new SqlParameter("@_TABLE__PK", obj._TABLE__PK));
            _list.Add(new SqlParameter("@_TABLE__PK2", obj._TABLE__PK2));
            _list.Add(new SqlParameter("@TEST_QUESTION_ID", obj.TEST_QUESTION_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_ITEM_ID", obj.TEST_QUESTION_ITEM_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_SOLUTION_ID", obj.TEST_QUESTION_SOLUTION_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_SOLUTION_ORDER", obj.TEST_QUESTION_SOLUTION_ORDER));

            int n = clsDataAccessHelper.ExecNonQuery("sp_test_question_solution_insert", _list);
            if (n == 1)
                result = true;
            return result;
        }

        public static bool Update(Object tmp)
        {
            TEST_QUESTION_SOLUTION obj = (TEST_QUESTION_SOLUTION)tmp;
            bool result = false;
            List<SqlParameter> _list = new List<SqlParameter>();
            _list.Add(new SqlParameter("@_TABLE__PK", obj._TABLE__PK));
            _list.Add(new SqlParameter("@_TABLE__PK2", obj._TABLE__PK2));
            _list.Add(new SqlParameter("@TEST_QUESTION_ID", obj.TEST_QUESTION_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_ITEM_ID", obj.TEST_QUESTION_ITEM_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_SOLUTION_ID", obj.TEST_QUESTION_SOLUTION_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_SOLUTION_ORDER", obj.TEST_QUESTION_SOLUTION_ORDER));

            int n = clsDataAccessHelper.ExecNonQuery("sp_test_question_solution_update", _list);
            if (n == 1)
                result = true;
            return result;
        }

        public static bool Delete(Object tmp)
        {
            TEST_QUESTION_SOLUTION obj = (TEST_QUESTION_SOLUTION)tmp;
            bool result = false;
            List<SqlParameter> _list = new List<SqlParameter>();
            _list.Add(new SqlParameter("@_TABLE__PK", obj._TABLE__PK));
            _list.Add(new SqlParameter("@_TABLE__PK2", obj._TABLE__PK2));
            _list.Add(new SqlParameter("@TEST_QUESTION_ID", obj.TEST_QUESTION_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_ITEM_ID", obj.TEST_QUESTION_ITEM_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_SOLUTION_ID", obj.TEST_QUESTION_SOLUTION_ID));
            _list.Add(new SqlParameter("@TEST_QUESTION_SOLUTION_ORDER", obj.TEST_QUESTION_SOLUTION_ORDER));

            int n = clsDataAccessHelper.ExecNonQuery("sp_test_question_solution_delete", _list);
            if (n == 1)
                result = true;
            return result;
        }

        public static List<TEST_QUESTION_SOLUTION> LoadAll()
        {
            List<TEST_QUESTION_SOLUTION> _list = new List<TEST_QUESTION_SOLUTION>();
            //call stored getlist here
            return _list;
        }
    }
}
